import { Map } from "immutable";
import {
  CHANGE_TOP_BANNERS,
  CHANGE_HOT_RECOMMEND,
  CHANGE_NEW_ALBUM,
  CHANGE_LIST_0,
  CHANGE_LIST_2,
  CHANGE_LIST_3,
} from "./constant";
const defaultState = Map({
  topBanners: [],
  hotRecommend: [],
  newAlbum: [],
  toplist: {},
  newList: {},
  originList: {},
});

function reducer(state = defaultState, action) {
  switch (action.type) {
    case CHANGE_TOP_BANNERS:
      return state.set("topBanners", action.topBanners);
    case CHANGE_HOT_RECOMMEND:
      return state.set("hotRecommend", action.hotRecommend);
    case CHANGE_NEW_ALBUM:
      return state.set("newAlbum", action.newAlbum);
    case CHANGE_LIST_0:
      return state.set("toplist", action.toplist);
    case CHANGE_LIST_2:
      return state.set("newList", action.newList);
    case CHANGE_LIST_3:
      return state.set("originlist", action.originlist);
    default:
      return state;
  }
}
export default reducer;
